package test;

import org.junit.Test;

import com.alibaba.fastjson.JSONObject;
import com.cn.wang.service.EHCache;

public class CacheDemo {
	private EHCache ehcache;
	@Test
	public void test() throws Exception{
		ehcache = new EHCache();
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("name", "wangzaogen");
		ehcache.addToCache("wang", jsonObject);
		
		   //从缓存中获取  
        JSONObject getobj = (JSONObject)ehcache.getCacheElement("wang");  
        System.out.println(getobj.toString()); 
	}

}
